package com.googlecode.tudojunto.persistence;

import java.io.Serializable;
import java.util.Map;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceException;

public interface GenericDAO<T, PK extends Serializable> {

	public T find(PK primaryKey) throws PersistenceException;

	public void save(final T entity) throws PersistenceException;

	public void setEntityManager(EntityManager entityManager);
	
	public void setEntityClass(Class<T> entityClass);
	
	public T find(final String namedQuery, final Map<String, Object> params) throws PersistenceException;
	
	public <E> E find(final Class<E> clazz, Serializable primaryKey) throws PersistenceException;
	
	public <E> E find(final Class<E> clazz, final String namedQuery, final Map<String, Object> params) throws PersistenceException;
	
	public <E> E find(final Class<E> clazz, final String namedQuery, final Object... param) throws PersistenceException;

	public Map<String, Object> newParameters();
	
}